package main

import "fmt"

//切片
func main() {
	arr := [6]int{1, 2, 3, 4, 5, 6}
	fmt.Println(arr)

	slice := arr[1:4]
	fmt.Println(slice)

	slice2 := []int{2, 3, 4, 5, 6}
	fmt.Println(slice2)
	test()
}

//初始化切片
func test() {
	var slice = make([]int, 2, 6)
	fmt.Println(slice, "切片的长度", len(slice), "容量是", cap(slice))
}
